<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="lg" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="lg2"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/font.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript"src="https://cdn.bootcss.com/blueimp-md5/2.10.0/js/md5.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/xadmin.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/cookie.js"></script>
</head>
  
  <body>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so">
        <a class="layui-btn layui-btn-small layui-icon layui-icon-refresh-3" style="float:right" href="${pageContext.request.contextPath}/train/list" title="返回"></a>
        
        	<input type="hidden" value="${plan.plan_id}" name="id">
          <input type="text" name="staff_name" value="${staff_name }" placeholder="学员名称" autocomplete="off" class="layui-input">
          <div class="layui-input-inline" >
				<select name="sex" lay-verify=""
					style="width: 150px; position: right" >
					<option value="${sex }">${sex }</option>
					<option value="男">男</option>
					<option value="女">女</option>
				</select>
			</div>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
        <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
        <button class="layui-btn" onclick="x_admin_show('添加学员','${pageContext.request.contextPath}/train/addS2PUI?pid=${plan.plan_id}',450,400)"><i class="layui-icon"></i>添加</button>
        <span class="x-right" style="line-height:40px">总共有${lg2:length(staff.list)}条数据 </span>  
      </xblock> 
      <table class="layui-table x-admin">
        <thead>
          <tr>
            <th>
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>
            
            <th>学员名称</th>
            <th>学员性别</th>
            <th>学员年龄</th>
            <th>学员民族</th>
            <th>email</th>
          </tr>
        </thead>
        <tbody>
        <lg:forEach items="${staff.list}" var="staff">
			<tr>
			<td><div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='${staff.id }'><i class="layui-icon">&#xe605;</i></div></td>
				<td>${staff.staff_name}</td>
				<td>${staff.sex}</td>
				<td>${staff.age}</td>
				<td>${staff.nation}</td>
				<td>${staff.email}</td>
			</tr>
		</lg:forEach>
        </tbody> 
      </table>
      <div class="page">
        <div>
          <a class="prev" href="${pageContext.request.contextPath}/train/Allstaff?staff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=${staff.prePage}&PageSize=${staff.pageSize}">&lt;&lt;</a> 
          <a class="num" href="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=1&PageSize=${staff.pageSize}">首页</a>
          <lg:forEach items="${staff.navigatepageNums}" var="na">
          	<lg:if test="${na==staff.pageNum}">
         		<span class="current" href="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=${na}&PageSize=${staff.pageSize}" style="font-size=16px">${na}</span>
        	</lg:if>
        	<lg:if test="${na!=staff.pageNum}">
        		<a class="num" href="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=${na}&PageSize=${staff.pageSize}"  >${na}</a>
        	</lg:if>
          </lg:forEach>
          <a class="num" href="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=${staff.pages}&PageSize=${staff.pageSize}">尾页</a>
          <a class="prev" href="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }&startPage=${staff.nextPage}&PageSize=${staff.pageSize}">&gt;&gt;</a> 
          <%-- <lg:forEach end="${staff.total}" begin="1" var="n">
           	<a class="num" href="${pageContext.request.contextPath}/staff/staffList?startPage=${na}">${na}</a>
          </lg:forEach> --%>
          <span>
          <form action="${pageContext.request.contextPath}/train/Allstaff?taff_name=${staff_name }&age=${age }&id=${plan.plan_id }" method="post" >
	         	每页显示数量<input style="width: 30px ; text-align: center" type="text" placeholder="输入展示数量" name="PageSize" value="${staff.pageSize}"/>
	         <input value="确定" class="glyphicon glyphicon-refresh" type="submit" />
          </form>
          </span>
        </div>
      </div>

    </div>
    <script>

      function delAll (argument) {

      	var pid = "${plan.plan_id}";
        var id = tableCheck.getData();
  
        layer.confirm('确认要删除吗？'+id,function(index){
        	$.ajax({
				url:"${pageContext.request.contextPath}/train/delS2P",   
				data:{"pid":pid,"staff_id":id.join(",")},
				dataType:"json",
				success:function(data){
            		
            	}
        	});
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>
</html>